package com.yuqiangz.mp.beans;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.enums.IdType;

import java.io.Serializable;

/**
 * @author 赵雨强
 * @create 2021/7/17 7:17
 * @description Employee javabean
 * MybatisPlus会默认使用实体类的类名到数据中找对应的表.
 * @TableName(value="tbl_employee")
 */
public class Employee extends Model<Employee> {

    /**
     * value 值是数据库中主键的名字
     * @TableId:
     * 	 * 	 value: 指定表中的主键列的列名， 如果实体属性名与列名一致，可以省略不指定.
     * 	 *   type: 指定主键策略.
     * 	 *   @TableId(value = "id", type = IdType.AUTO)
     * @TableField(exist=false)
     *   *   是否为数据库字段
     */

    private Integer id;
    private String lastName;
    private String email;
    private Integer gender;
    private Integer age;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Employee{" +
                "id=" + id +
                ", lastName='" + lastName + '\'' +
                ", email='" + email + '\'' +
                ", gender=" + gender +
                ", age=" + age +
                '}';
    }

    /**
     * 主键值
     */
    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
